#pragma once

/* 
* http://www.codeproject.com/KB/graphics/render.aspx
* "Rendering GIF, JPEG, Icon, or Bitmap Files with OleLoadPicture"
*/

#include "Macros.h"

class DLLEXPIMP ImageRender
{
public:
	// GetImageSize() returns the height and width of the image in szFile. 
	// These values are in device units for the DC passed in to the function.
	// It  is good to use this function to fetch the true size of the image, 
	// in case you want to let the user reset the image display. 
	static bool GetImageSize(CDC* pDC, LPCTSTR szFile, int* pnHeight, int* pnWidth);


	// DrawImage() will render the image whose pathname is passed in in csFile into the area of the rectangle in rectImage.
	// rectImage must be in device units. 
	// Important: These functions assume a DC mapping mode with MM_TEXT. That is, negative Y is upward.
	// If you are going to use other mode, you will need to change the signs of the height variables in the Render() function call. 
	static bool DrawImage(CDC* pDC, LPCTSTR szFile, CRect rectView, CRect rectImage);

	// LoadPictureFile() loads the image bytes in szFile into pgpPicture
	static bool LoadPictureFile(LPCTSTR szFile, LPPICTURE* pgpPicture);
};